//统一管理项目中所有的请求路径  api
import request from "./request";
import qs from "qs"


//首页精品推荐请求
// export const JingPin = function () {
//     return request.get("/products/recommend")
// }
export const JingPinAPI = () => request.get("/products/recommend")

//首页热门兑换请求
export const RemenAPI = () => request.get("/products/hot")



//  获取验证码的SendSMS请求
export const SendSMSAPI = params => request.post("/sendSMS", qs.stringify(params))

// ({ aa: 10, bb: 20 })
//JSON.stringify   "{ aa: 10, bb: 20 }"
//qs.stringify      aa=10&bb=20

// 点击登录按钮的请求
export const PhoneLoginAPI = params => request.post("/phoneRegin", qs.stringify(params))


//微信扫码登录
export const WeixinLoginAPI = params => request.post("/wechatUsers/PCLogin", qs.stringify(params))

//微信绑定手机号
export const BindPhoneAPI = params => request.post("/wechatUsers/binding", qs.stringify(params))

//获取用户信息
export const UserProfilesAPI = () => request.get("/shop/userProfiles")

//获取商品详情信息请求
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`)

//加入购物车请求
export const AddToCartAPI = params => request.post("/shop/carts/add", qs.stringify(params))

//全部商品页包括搜索请求
export const GoodSearchAPI = (params) => request.get("/products", { params })

//查看购物车请求
export const ShopCartAPI = () => request.get("/shop/carts")

//购物车删除商品
export const DelShopCartAPI = (id) => request.delete(`/shop/carts?productIds=${id}`)

